using STD.Services.UserService.Domain.Entities;

namespace STD.Services.UserService.Domain.Repositories;

/// <summary>
/// 用户仓储接口
/// </summary>
public interface IUserRepository
{
    /// <summary>
    /// 根据ID获取用户
    /// </summary>
    /// <param name="id">用户ID</param>
    /// <returns>用户</returns>
    Task<User?> GetByIdAsync(Guid id);
    
    /// <summary>
    /// 根据用户名获取用户
    /// </summary>
    /// <param name="username">用户名</param>
    /// <returns>用户</returns>
    Task<User?> GetByUsernameAsync(string username);
    
    /// <summary>
    /// 根据邮箱获取用户
    /// </summary>
    /// <param name="email">邮箱</param>
    /// <returns>用户</returns>
    Task<User?> GetByEmailAsync(string email);
    
    /// <summary>
    /// 获取所有用户
    /// </summary>
    /// <param name="skip">跳过数量</param>
    /// <param name="take">获取数量</param>
    /// <returns>用户列表</returns>
    Task<IEnumerable<User>> GetAllAsync(int skip = 0, int take = 100);
    
    /// <summary>
    /// 添加用户
    /// </summary>
    /// <param name="user">用户</param>
    /// <returns>任务</returns>
    Task AddAsync(User user);
    
    /// <summary>
    /// 更新用户
    /// </summary>
    /// <param name="user">用户</param>
    /// <returns>任务</returns>
    Task UpdateAsync(User user);
    
    /// <summary>
    /// 删除用户
    /// </summary>
    /// <param name="user">用户</param>
    /// <returns>任务</returns>
    Task DeleteAsync(User user);
    
    /// <summary>
    /// 检查用户名是否存在
    /// </summary>
    /// <param name="username">用户名</param>
    /// <returns>是否存在</returns>
    Task<bool> ExistsByUsernameAsync(string username);
    
    /// <summary>
    /// 检查邮箱是否存在
    /// </summary>
    /// <param name="email">邮箱</param>
    /// <returns>是否存在</returns>
    Task<bool> ExistsByEmailAsync(string email);
} 